<a href='https://github.com/angular/angular.js/edit/v1.5.x/src/ngMock/angular-mocks.js?message=docs($httpBackend)%3A%20describe%20your%20change...#L1002' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit">&nbsp;</i>Improve this Doc</a>



<a href='https://github.com/angular/angular.js/tree/v1.5.8/src/ngMock/angular-mocks.js#L1002' class='view-source pull-right btn btn-primary'>
  <i class="glyphicon glyphicon-zoom-in">&nbsp;</i>View Source
</a>


<header class="api-profile-header">
  <h1 class="api-profile-header-heading">$httpBackend</h1>
  <ol class="api-profile-header-structure naked-list step-list">
    
  

    <li>
      - service in module <a href="api/ngMock">ngMock</a>
    </li>
  </ol>
</header>



<div class="api-profile-description">
  <p>Fake HTTP backend implementation suitable for unit testing applications that use the
<a href="api/ng/service/$http">$http service</a>.</p>
<div class="alert alert-info">
<strong>Note</strong>: For fake HTTP backend implementation suitable for end-to-end testing or backend-less
development please see <a href="api/ngMockE2E/service/$httpBackend">e2e $httpBackend mock</a>.
</div>

<p>During unit testing, we want our unit tests to run quickly and have no external dependencies so
we don’t want to send <a href="https://developer.mozilla.org/en/xmlhttprequest">XHR</a> or
<a href="http://en.wikipedia.org/wiki/JSONP">JSONP</a> requests to a real server. All we really need is
to verify whether a certain request has been sent or not, or alternatively just let the
application make requests, respond with pre-trained responses and assert that the end result is
what we expect it to be.</p>
<p>This mock implementation can be used to respond with static or dynamic responses via the
<code>expect</code> and <code>when</code> apis and their shortcuts (<code>expectGET</code>, <code>whenPOST</code>, etc).</p>
<p>When an Angular application needs some data from a server, it calls the $http service, which
sends the request to a real server using $httpBackend service. With dependency injection, it is
easy to inject $httpBackend mock (which has the same API as $httpBackend) and use it to verify
the requests and respond with some testing data without sending a request to a real server.</p>
<p>There are two ways to specify what test data should be returned as http responses by the mock
backend when the code under test makes http requests:</p>
<ul>
<li><code>$httpBackend.expect</code> - specifies a request expectation</li>
<li><code>$httpBackend.when</code> - specifies a backend definition</li>
</ul>
<h2 id="request-expectations-vs-backend-definitions">Request Expectations vs Backend Definitions</h2>
<p>Request expectations provide a way to make assertions about requests made by the application and
to define responses for those requests. The test will fail if the expected requests are not made
or they are made in the wrong order.</p>
<p>Backend definitions allow you to define a fake backend for your application which doesn&#39;t assert
if a particular request was made or not, it just returns a trained response if a request is made.
The test will pass whether or not the request gets made during testing.</p>
<table class="table">
  <tr><th width="220px"></th><th>Request expectations</th><th>Backend definitions</th></tr>
  <tr>
    <th>Syntax</th>
    <td>.expect(...).respond(...)</td>
    <td>.when(...).respond(...)</td>
  </tr>
  <tr>
    <th>Typical usage</th>
    <td>strict unit tests</td>
    <td>loose (black-box) unit testing</td>
  </tr>
  <tr>
    <th>Fulfills multiple requests</th>
    <td>NO</td>
    <td>YES</td>
  </tr>
  <tr>
    <th>Order of requests matters</th>
    <td>YES</td>
    <td>NO</td>
  </tr>
  <tr>
    <th>Request required</th>
    <td>YES</td>
    <td>NO</td>
  </tr>
  <tr>
    <th>Response required</th>
    <td>optional (see below)</td>
    <td>YES</td>
  </tr>
</table>

<p>In cases where both backend definitions and request expectations are specified during unit
testing, the request expectations are evaluated first.</p>
<p>If a request expectation has no response specified, the algorithm will search your backend
definitions for an appropriate response.</p>
<p>If a request didn&#39;t match any expectation or if the expectation doesn&#39;t have the response
defined, the backend definitions are evaluated in sequential order to see if any of them match
the request. The response from the first matched definition is returned.</p>
<h2 id="flushing-http-requests">Flushing HTTP requests</h2>
<p>The $httpBackend used in production always responds to requests asynchronously. If we preserved
this behavior in unit testing, we&#39;d have to create async unit tests, which are hard to write,
to follow and to maintain. But neither can the testing mock respond synchronously; that would
change the execution of the code under test. For this reason, the mock $httpBackend has a
<code>flush()</code> method, which allows the test to explicitly flush pending requests. This preserves
the async api of the backend, while allowing the test to execute synchronously.</p>
<h2 id="unit-testing-with-mock-httpbackend">Unit testing with mock $httpBackend</h2>
<p>The following code shows how to setup and use the mock backend when unit testing a controller.
First we create the controller under test:</p>
<pre><code class="lang-js">// The module code
angular
  .module(&#39;MyApp&#39;, [])
  .controller(&#39;MyController&#39;, MyController);

// The controller code
function MyController($scope, $http) {
  var authToken;

  $http.get(&#39;/auth.py&#39;).then(function(response) {
    authToken = response.headers(&#39;A-Token&#39;);
    $scope.user = response.data;
  });

  $scope.saveMessage = function(message) {
    var headers = { &#39;Authorization&#39;: authToken };
    $scope.status = &#39;Saving...&#39;;

    $http.post(&#39;/add-msg.py&#39;, message, { headers: headers } ).then(function(response) {
      $scope.status = &#39;&#39;;
    }).catch(function() {
      $scope.status = &#39;Failed...&#39;;
    });
  };
}
</code></pre>
<p>Now we setup the mock backend and create the test specs:</p>
<pre><code class="lang-js">// testing controller
describe(&#39;MyController&#39;, function() {
   var $httpBackend, $rootScope, createController, authRequestHandler;

   // Set up the module
   beforeEach(module(&#39;MyApp&#39;));

   beforeEach(inject(function($injector) {
     // Set up the mock http service responses
     $httpBackend = $injector.get(&#39;$httpBackend&#39;);
     // backend definition common for all tests
     authRequestHandler = $httpBackend.when(&#39;GET&#39;, &#39;/auth.py&#39;)
                            .respond({userId: &#39;userX&#39;}, {&#39;A-Token&#39;: &#39;xxx&#39;});

     // Get hold of a scope (i.e. the root scope)
     $rootScope = $injector.get(&#39;$rootScope&#39;);
     // The $controller service is used to create instances of controllers
     var $controller = $injector.get(&#39;$controller&#39;);

     createController = function() {
       return $controller(&#39;MyController&#39;, {&#39;$scope&#39; : $rootScope });
     };
   }));


   afterEach(function() {
     $httpBackend.verifyNoOutstandingExpectation();
     $httpBackend.verifyNoOutstandingRequest();
   });


   it(&#39;should fetch authentication token&#39;, function() {
     $httpBackend.expectGET(&#39;/auth.py&#39;);
     var controller = createController();
     $httpBackend.flush();
   });


   it(&#39;should fail authentication&#39;, function() {

     // Notice how you can change the response even after it was set
     authRequestHandler.respond(401, &#39;&#39;);

     $httpBackend.expectGET(&#39;/auth.py&#39;);
     var controller = createController();
     $httpBackend.flush();
     expect($rootScope.status).toBe(&#39;Failed...&#39;);
   });


   it(&#39;should send msg to server&#39;, function() {
     var controller = createController();
     $httpBackend.flush();

     // now you don’t care about the authentication, but
     // the controller will still send the request and
     // $httpBackend will respond without you having to
     // specify the expectation and response for this request

     $httpBackend.expectPOST(&#39;/add-msg.py&#39;, &#39;message content&#39;).respond(201, &#39;&#39;);
     $rootScope.saveMessage(&#39;message content&#39;);
     expect($rootScope.status).toBe(&#39;Saving...&#39;);
     $httpBackend.flush();
     expect($rootScope.status).toBe(&#39;&#39;);
   });


   it(&#39;should send auth header&#39;, function() {
     var controller = createController();
     $httpBackend.flush();

     $httpBackend.expectPOST(&#39;/add-msg.py&#39;, undefined, function(headers) {
       // check if the header was sent, if it wasn&#39;t the expectation won&#39;t
       // match the request and the test will fail
       return headers[&#39;Authorization&#39;] == &#39;xxx&#39;;
     }).respond(201, &#39;&#39;);

     $rootScope.saveMessage(&#39;whatever&#39;);
     $httpBackend.flush();
   });
});
</code></pre>
<h2 id="dynamic-responses">Dynamic responses</h2>
<p>You define a response to a request by chaining a call to <code>respond()</code> onto a definition or expectation.
If you provide a <strong>callback</strong> as the first parameter to <code>respond(callback)</code> then you can dynamically generate
a response based on the properties of the request.</p>
<p>The <code>callback</code> function should be of the form <code>function(method, url, data, headers, params)</code>.</p>
<h3 id="query-parameters">Query parameters</h3>
<p>By default, query parameters on request URLs are parsed into the <code>params</code> object. So a request URL
of <code>/list?q=searchstr&amp;orderby=-name</code> would set <code>params</code> to be <code>{q: &#39;searchstr&#39;, orderby: &#39;-name&#39;}</code>.</p>
<h3 id="regex-parameter-matching">Regex parameter matching</h3>
<p>If an expectation or definition uses a <strong>regex</strong> to match the URL, you can provide an array of <strong>keys</strong> via a
<code>params</code> argument. The index of each <strong>key</strong> in the array will match the index of a <strong>group</strong> in the
<strong>regex</strong>.</p>
<p>The <code>params</code> object in the <strong>callback</strong> will now have properties with these keys, which hold the value of the
corresponding <strong>group</strong> in the <strong>regex</strong>.</p>
<p>This also applies to the <code>when</code> and <code>expect</code> shortcut methods.</p>
<pre><code class="lang-js">$httpBackend.expect(&#39;GET&#39;, /\/user\/(.+)/, undefined, undefined, [&#39;id&#39;])
  .respond(function(method, url, data, headers, params) {
    // for requested url of &#39;/user/1234&#39; params is {id: &#39;1234&#39;}
  });

$httpBackend.whenPATCH(/\/user\/(.+)\/article\/(.+)/, undefined, undefined, [&#39;user&#39;, &#39;article&#39;])
  .respond(function(method, url, data, headers, params) {
    // for url of &#39;/user/1234/article/567&#39; params is {user: &#39;1234&#39;, article: &#39;567&#39;}
  });
</code></pre>
<h2 id="matching-route-requests">Matching route requests</h2>
<p>For extra convenience, <code>whenRoute</code> and <code>expectRoute</code> shortcuts are available. These methods offer colon
delimited matching of the url path, ignoring the query string. This allows declarations
similar to how application routes are configured with <code>$routeProvider</code>. Because these methods convert
the definition url to regex, declaration order is important. Combined with query parameter parsing,
the following is possible:</p>
<pre><code class="lang-js">$httpBackend.whenRoute(&#39;GET&#39;, &#39;/users/:id&#39;)
  .respond(function(method, url, data, headers, params) {
    return [200, MockUserList[Number(params.id)]];
  });

$httpBackend.whenRoute(&#39;GET&#39;, &#39;/users&#39;)
  .respond(function(method, url, data, headers, params) {
    var userList = angular.copy(MockUserList),
      defaultSort = &#39;lastName&#39;,
      count, pages, isPrevious, isNext;

    // paged api response &#39;/v1/users?page=2&#39;
    params.page = Number(params.page) || 1;

    // query for last names &#39;/v1/users?q=Archer&#39;
    if (params.q) {
      userList = $filter(&#39;filter&#39;)({lastName: params.q});
    }

    pages = Math.ceil(userList.length / pagingLength);
    isPrevious = params.page &gt; 1;
    isNext = params.page &lt; pages;

    return [200, {
      count:    userList.length,
      previous: isPrevious,
      next:     isNext,
      // sort field -&gt; &#39;/v1/users?sortBy=firstName&#39;
      results:  $filter(&#39;orderBy&#39;)(userList, params.sortBy || defaultSort)
                  .splice((params.page - 1) * pagingLength, pagingLength)
    }];
  });
</code></pre>

</div>






<div>
  

    

  

  
<h2>Methods</h2>
<ul class="methods">
  <li id="when">
    <h3><p><code>when(method, url, [data], [headers], [keys]);</code></p>

</h3>
    <div><p>Creates a new backend definition.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        method
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a>
      </td>
      <td>
        <p>HTTP method.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP url or function that receives a url
  and returns true if the url matches the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        data
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP request body or function that receives
  data string and returns true if the data is as expected.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        headers
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-function">function(Object)</a>
      </td>
      <td>
        <p>HTTP headers or function that receives http header
  object and returns true if the headers match the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        keys
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-array">Array</a>
      </td>
      <td>
        <p>Array of keys to assign to regex matches in request url described above.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
  request is handled. You can save this object for later use and invoke <code>respond</code> again in
  order to change how a matched request is handled.</p>
<ul>
<li>respond –<pre><code class="lang-js">{function([status,] data[, headers, statusText])
| function(function(method, url, data, headers, params)}
</code></pre>
– The respond method takes a set of static data to be returned or a function that can
return an array containing response status (number), response data (Array|Object|string),
response headers (Object), and the text for the status (string). The respond method returns
the <code>requestHandler</code> object for possible overrides.</li>
</ul>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="whenGET">
    <h3><p><code>whenGET(url, [headers], [keys]);</code></p>

</h3>
    <div><p>Creates a new backend definition for GET requests. For more info see <code>when()</code>.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP url or function that receives a url
  and returns true if the url matches the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        headers
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-function">function(Object)</a>
      </td>
      <td>
        <p>HTTP headers.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        keys
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-array">Array</a>
      </td>
      <td>
        <p>Array of keys to assign to regex matches in request url described above.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
request is handled. You can save this object for later use and invoke <code>respond</code> again in
order to change how a matched request is handled.</p>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="whenHEAD">
    <h3><p><code>whenHEAD(url, [headers], [keys]);</code></p>

</h3>
    <div><p>Creates a new backend definition for HEAD requests. For more info see <code>when()</code>.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP url or function that receives a url
  and returns true if the url matches the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        headers
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-function">function(Object)</a>
      </td>
      <td>
        <p>HTTP headers.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        keys
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-array">Array</a>
      </td>
      <td>
        <p>Array of keys to assign to regex matches in request url described above.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
request is handled. You can save this object for later use and invoke <code>respond</code> again in
order to change how a matched request is handled.</p>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="whenDELETE">
    <h3><p><code>whenDELETE(url, [headers], [keys]);</code></p>

</h3>
    <div><p>Creates a new backend definition for DELETE requests. For more info see <code>when()</code>.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP url or function that receives a url
  and returns true if the url matches the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        headers
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-function">function(Object)</a>
      </td>
      <td>
        <p>HTTP headers.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        keys
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-array">Array</a>
      </td>
      <td>
        <p>Array of keys to assign to regex matches in request url described above.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
request is handled. You can save this object for later use and invoke <code>respond</code> again in
order to change how a matched request is handled.</p>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="whenPOST">
    <h3><p><code>whenPOST(url, [data], [headers], [keys]);</code></p>

</h3>
    <div><p>Creates a new backend definition for POST requests. For more info see <code>when()</code>.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP url or function that receives a url
  and returns true if the url matches the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        data
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP request body or function that receives
  data string and returns true if the data is as expected.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        headers
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-function">function(Object)</a>
      </td>
      <td>
        <p>HTTP headers.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        keys
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-array">Array</a>
      </td>
      <td>
        <p>Array of keys to assign to regex matches in request url described above.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
request is handled. You can save this object for later use and invoke <code>respond</code> again in
order to change how a matched request is handled.</p>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="whenPUT">
    <h3><p><code>whenPUT(url, [data], [headers], [keys]);</code></p>

</h3>
    <div><p>Creates a new backend definition for PUT requests.  For more info see <code>when()</code>.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP url or function that receives a url
  and returns true if the url matches the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        data
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP request body or function that receives
  data string and returns true if the data is as expected.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        headers
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-function">function(Object)</a>
      </td>
      <td>
        <p>HTTP headers.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        keys
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-array">Array</a>
      </td>
      <td>
        <p>Array of keys to assign to regex matches in request url described above.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
request is handled. You can save this object for later use and invoke <code>respond</code> again in
order to change how a matched request is handled.</p>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="whenJSONP">
    <h3><p><code>whenJSONP(url, [keys]);</code></p>

</h3>
    <div><p>Creates a new backend definition for JSONP requests. For more info see <code>when()</code>.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP url or function that receives a url
  and returns true if the url matches the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        keys
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-array">Array</a>
      </td>
      <td>
        <p>Array of keys to assign to regex matches in request url described above.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
request is handled. You can save this object for later use and invoke <code>respond</code> again in
order to change how a matched request is handled.</p>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="whenRoute">
    <h3><p><code>whenRoute(method, url);</code></p>

</h3>
    <div><p>Creates a new backend definition that compares only with the requested route.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        method
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a>
      </td>
      <td>
        <p>HTTP method.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a>
      </td>
      <td>
        <p>HTTP url string that supports colon param matching.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
request is handled. You can save this object for later use and invoke <code>respond</code> again in
order to change how a matched request is handled. See #when for more info.</p>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="expect">
    <h3><p><code>expect(method, url, [data], [headers], [keys]);</code></p>

</h3>
    <div><p>Creates a new request expectation.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        method
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a>
      </td>
      <td>
        <p>HTTP method.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP url or function that receives a url
  and returns true if the url matches the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        data
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a><a href="" class="label type-hint type-hint-object">Object</a>
      </td>
      <td>
        <p>HTTP request body or function that
 receives data string and returns true if the data is as expected, or Object if request body
 is in JSON format.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        headers
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-function">function(Object)</a>
      </td>
      <td>
        <p>HTTP headers or function that receives http header
  object and returns true if the headers match the current expectation.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        keys
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-array">Array</a>
      </td>
      <td>
        <p>Array of keys to assign to regex matches in request url described above.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
 request is handled. You can save this object for later use and invoke <code>respond</code> again in
 order to change how a matched request is handled.</p>
<ul>
<li>respond –<pre><code>{ function([status,] data[, headers, statusText])
| function(function(method, url, data, headers, params)}
</code></pre>
– The respond method takes a set of static data to be returned or a function that can
return an array containing response status (number), response data (Array|Object|string),
response headers (Object), and the text for the status (string). The respond method returns
the <code>requestHandler</code> object for possible overrides.</li>
</ul>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="expectGET">
    <h3><p><code>expectGET(url, [headers], [keys]);</code></p>

</h3>
    <div><p>Creates a new request expectation for GET requests. For more info see <code>expect()</code>.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP url or function that receives a url
  and returns true if the url matches the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        headers
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-object">Object</a>
      </td>
      <td>
        <p>HTTP headers.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        keys
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-array">Array</a>
      </td>
      <td>
        <p>Array of keys to assign to regex matches in request url described above.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
request is handled. You can save this object for later use and invoke <code>respond</code> again in
order to change how a matched request is handled. See #expect for more info.</p>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="expectHEAD">
    <h3><p><code>expectHEAD(url, [headers], [keys]);</code></p>

</h3>
    <div><p>Creates a new request expectation for HEAD requests. For more info see <code>expect()</code>.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP url or function that receives a url
  and returns true if the url matches the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        headers
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-object">Object</a>
      </td>
      <td>
        <p>HTTP headers.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        keys
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-array">Array</a>
      </td>
      <td>
        <p>Array of keys to assign to regex matches in request url described above.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
  request is handled. You can save this object for later use and invoke <code>respond</code> again in
  order to change how a matched request is handled.</p>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="expectDELETE">
    <h3><p><code>expectDELETE(url, [headers], [keys]);</code></p>

</h3>
    <div><p>Creates a new request expectation for DELETE requests. For more info see <code>expect()</code>.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP url or function that receives a url
  and returns true if the url matches the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        headers
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-object">Object</a>
      </td>
      <td>
        <p>HTTP headers.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        keys
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-array">Array</a>
      </td>
      <td>
        <p>Array of keys to assign to regex matches in request url described above.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
  request is handled. You can save this object for later use and invoke <code>respond</code> again in
  order to change how a matched request is handled.</p>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="expectPOST">
    <h3><p><code>expectPOST(url, [data], [headers], [keys]);</code></p>

</h3>
    <div><p>Creates a new request expectation for POST requests. For more info see <code>expect()</code>.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP url or function that receives a url
  and returns true if the url matches the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        data
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a><a href="" class="label type-hint type-hint-object">Object</a>
      </td>
      <td>
        <p>HTTP request body or function that
 receives data string and returns true if the data is as expected, or Object if request body
 is in JSON format.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        headers
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-object">Object</a>
      </td>
      <td>
        <p>HTTP headers.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        keys
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-array">Array</a>
      </td>
      <td>
        <p>Array of keys to assign to regex matches in request url described above.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
  request is handled. You can save this object for later use and invoke <code>respond</code> again in
  order to change how a matched request is handled.</p>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="expectPUT">
    <h3><p><code>expectPUT(url, [data], [headers], [keys]);</code></p>

</h3>
    <div><p>Creates a new request expectation for PUT requests. For more info see <code>expect()</code>.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP url or function that receives a url
  and returns true if the url matches the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        data
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a><a href="" class="label type-hint type-hint-object">Object</a>
      </td>
      <td>
        <p>HTTP request body or function that
 receives data string and returns true if the data is as expected, or Object if request body
 is in JSON format.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        headers
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-object">Object</a>
      </td>
      <td>
        <p>HTTP headers.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        keys
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-array">Array</a>
      </td>
      <td>
        <p>Array of keys to assign to regex matches in request url described above.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
  request is handled. You can save this object for later use and invoke <code>respond</code> again in
  order to change how a matched request is handled.</p>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="expectPATCH">
    <h3><p><code>expectPATCH(url, [data], [headers], [keys]);</code></p>

</h3>
    <div><p>Creates a new request expectation for PATCH requests. For more info see <code>expect()</code>.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP url or function that receives a url
  and returns true if the url matches the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        data
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a><a href="" class="label type-hint type-hint-object">Object</a>
      </td>
      <td>
        <p>HTTP request body or function that
 receives data string and returns true if the data is as expected, or Object if request body
 is in JSON format.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        headers
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-object">Object</a>
      </td>
      <td>
        <p>HTTP headers.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        keys
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-array">Array</a>
      </td>
      <td>
        <p>Array of keys to assign to regex matches in request url described above.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
  request is handled. You can save this object for later use and invoke <code>respond</code> again in
  order to change how a matched request is handled.</p>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="expectJSONP">
    <h3><p><code>expectJSONP(url, [keys]);</code></p>

</h3>
    <div><p>Creates a new request expectation for JSONP requests. For more info see <code>expect()</code>.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a><a href="" class="label type-hint type-hint-function">function(string)</a>
      </td>
      <td>
        <p>HTTP url or function that receives an url
  and returns true if the url matches the current definition.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        keys
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-array">Array</a>
      </td>
      <td>
        <p>Array of keys to assign to regex matches in request url described above.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
  request is handled. You can save this object for later use and invoke <code>respond</code> again in
  order to change how a matched request is handled.</p>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="expectRoute">
    <h3><p><code>expectRoute(method, url);</code></p>

</h3>
    <div><p>Creates a new request expectation that compares only with the requested route.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        method
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a>
      </td>
      <td>
        <p>HTTP method.</p>

        
      </td>
    </tr>
    
    <tr>
      <td>
        url
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a>
      </td>
      <td>
        <p>HTTP url string that supports colon param matching.</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    
    <h4>Returns</h4>
    <table class="variables-matrix return-arguments">
  <tr>
    <td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td>
    <td><p>Returns an object with <code>respond</code> method that controls how a matched
request is handled. You can save this object for later use and invoke <code>respond</code> again in
order to change how a matched request is handled. See #expect for more info.</p>
</td>
  </tr>
</table>
    

  </li>
  
  <li id="flush">
    <h3><p><code>flush([count]);</code></p>

</h3>
    <div><p>Flushes all pending requests using the trained responses.</p>
</div>

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        count
        
        <div><em>(optional)</em></div>
      </td>
      <td>
        <a href="" class="label type-hint type-hint-number">number</a>
      </td>
      <td>
        <p>Number of responses to flush (in the order they arrived). If undefined,
  all pending requests will be flushed. If there are no pending requests when the flush method
  is called an exception is thrown (as this typically a sign of programming error).</p>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    
    
    

  </li>
  
  <li id="verifyNoOutstandingExpectation">
    <h3><p><code>verifyNoOutstandingExpectation();</code></p>

</h3>
    <div><p>Verifies that all of the requests defined via the <code>expect</code> api were made. If any of the
requests were not made, verifyNoOutstandingExpectation throws an exception.</p>
<p>Typically, you would call this method following each test case that asserts requests using an
&quot;afterEach&quot; clause.</p>
<pre><code class="lang-js">afterEach($httpBackend.verifyNoOutstandingExpectation);
</code></pre>
</div>

    

    
    
    

  </li>
  
  <li id="verifyNoOutstandingRequest">
    <h3><p><code>verifyNoOutstandingRequest();</code></p>

</h3>
    <div><p>Verifies that there are no outstanding requests that need to be flushed.</p>
<p>Typically, you would call this method following each test case that asserts requests using an
&quot;afterEach&quot; clause.</p>
<pre><code class="lang-js">afterEach($httpBackend.verifyNoOutstandingRequest);
</code></pre>
</div>

    

    
    
    

  </li>
  
  <li id="resetExpectations">
    <h3><p><code>resetExpectations();</code></p>

</h3>
    <div><p>Resets all request expectations, but preserves all backend definitions. Typically, you would
call resetExpectations during a multiple-phase test when you want to reuse the same instance of
$httpBackend mock.</p>
</div>

    

    
    
    

  </li>
  </ul>
  
  



  
</div>


